package com.ybf.api.mapper;

import com.ybf.api.entity.RolePermissions;
import com.ybf.api.mapper.provider.RolePermissionsProvider;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ybf
 * @since 2024-09-26
 */
@Mapper
public interface RolePermissionsMapper {

    @SelectProvider(type = RolePermissionsProvider.class, method = "findAll")
    List<RolePermissions> list(@Param("rolepermissions") RolePermissions rolepermissions);

    @Delete("delete from role_permissions where id = #{id}")
    Integer delete(@Param("id") Integer id);

    @Select("select  from role_permissions where id = #{id}")
    RolePermissions info(@Param("id") Integer id);


    @Insert("insert into role_permissions (status) values (#{rolepermissions.status})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    Integer add(@Param("rolepermissions") RolePermissions rolepermissions);

    @Update("update role_permissions set status = '#{rolepermissions.status}' where id = #{rolepermissions.id}")
    Integer edit(@Param("rolepermissions") RolePermissions rolepermissions);
}